package com.nq.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nq.pojo.StockSubscribe;
import com.nq.pojo.User;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface UserMapper extends BaseMapper<User> {

    int deleteByPrimaryKey(Integer paramInteger);

    int insert(User paramUser);

    int insertSelective(User paramUser);

    User selectByPrimaryKey(Integer paramInteger);

    int updateByPrimaryKeySelective(User paramUser);

    int updateByPrimaryKey(User paramUser);

    User findByPhone(@Param("code") String paramString, @Param("account") String paramString2);

    User findByPhoneOrEmail(@Param("account") String paramString2);

    User login(@Param("loginType") String paramString1, @Param("code") String code, @Param("account") String paramString2,
               @Param("userPwd") String paramString3, @Param("country") String country);


    List listByAdmin(@Param("userId") Integer userId,
                     @Param("realName") String realName,
                     @Param("phone") String phone,
                     @Param("email") String email,
                     @Param("agentId") Integer agentId,
                     @Param("accountType") Integer paramInteger2,
                     @Param("isActive") Integer isActive,
                     @Param("isLock") Integer isLock,
                     @Param("isRecharge") Integer isRecharge,
                     @Param("beginAmount") String beginAmount,
                     @Param("endAmount") String endAmount,
                     @Param("beginTimeReg") Date beginTimeReg,
                     @Param("endTimeReg") Date endTimeReg,
                     @Param("beginTimeAudit") Date beginTimeAudit,
                     @Param("endTimeAudit") Date endTimeAudit
                     );

    int CountUserSize(Integer paramInteger);

    BigDecimal CountUserAmt(Integer paramInteger);

    BigDecimal CountEnableAmt(Integer paramInteger);

    @Select("select with_pwd from `user` where with_pwd=#{with_pwd}")
    String findWithPwd(String with_pwd);

    @Select("select with_pwd from `user` where phone=#{phone}")
    String findIdWithPwd(String phone);

    @Update("update `user` set with_pwd=#{with_pwd} where phone=#{phone}")
    int updateWithPwd(@Param("with_pwd") String paramString1, @Param("phone") String paramString2);

//    @Update("update `user` set user_amt = user_amt + #{user_amt} where id = #{user_id}")
    int updateUserAmt(@Param("user_amt") Double user_amt, @Param("user_id") Integer user_id);

    /**
     * 获取虚拟用户 user开头最大的用户昵称
     * @return
     */
    User getMaxVrUserNickName();

    /**
     * 获取我的上级接口
     * @param parentId
     * @return
     */
    User getParentUser(@Param("parentId") Integer parentId);

    /**
     * 获取我的下级接口
     * @param userId
     * @return
     */
    List<User> listChildUser(@Param("userId") Integer userId);


    User selectByIdCard(@Param("idCard") String idCard);

    List<User> listByAgent(@Param("userId") Integer userId, @Param("isRecharge") Integer isRecharge, @Param("realName") String realName,
                           @Param("phone") String phone, @Param("searchId") Integer searchId, @Param("accountType") Integer accountType,
                           @Param("isActive") Integer isActive);
}
